import { useI18n } from '/@/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '/@/components/Table';
// import { orderPicListData } from '/@/api/m8/order/order';
import { blListData } from '/@/api/m8/flow/flow';


const { t } = useI18n('sys.basVen');

// 补料图纸选择
const modalProps = {
  title: t('流程选择'),
};

const searchForm: FormProps = {
  baseColProps: { lg: 6, md: 8 },
  labelWidth: 90,
  schemas: [
    {
      label: t('扫一扫'),
      field: 'picBarCode',
      component: 'Input',
    },
    {
      label: t('图名'),
      field: 'orderPic.picname',
      component: 'Input',
    },
    {
      label: t('图号'),
      field: 'orderPic.picno',
      component: 'Input',
    },
  ],
  fieldMapToTime: [['order.xtdate', ['order.xtdate_gte', 'order.xtdate_lte']]],
};

const tableColumns: BasicColumn[] = [
  {
    title: t('图号'),
    dataIndex: 'orderPic.picno',
    width: 130,
    align: 'left',
  },
  {
    title: t('图名'),
    dataIndex: 'orderPic.picname',
    width: 200,
    align: 'left',
  },
  {
    title: t('规格'),
    dataIndex: 'orderPic.cinvstd',
    width: 130,
    align: 'left',
  },
 
  {
    title: t('材料'),
    dataIndex: 'orderPic.cmat',
    width: 100,
    align: 'left',
  },
  {
    title: t('工序'),
    dataIndex: 'oper.operCode',
    width: 100,
    align: 'left',
  },
  {
    title: t('数量'),
    dataIndex: 'orderPic.iqty',
    width: 100,
    align: 'right',
  },
  {
    title: t('订单编号'),
    dataIndex: 'order.ccode',
    width: 130,
    align: 'left',
  },
];

const tableProps: BasicTableProps = {
  api: blListData,
  beforeFetch: (params) => {
    params['isAll'] = true;
    return params;
  },
  columns: tableColumns,
  formConfig: searchForm,
  rowKey: 'id',
};

export default {
  modalProps,
  tableProps,
  itemCode: 'id',
  itemName: 'id',
};
